Skip to main content

Overview

In the Architecture Overview, we took a look at the different components that make up the Euclid Unified Liquidity layer. In this section, we will be looking at each of the Euclid smart contracts and their respective messages.

Since the Factory smart contract is the only entry point for users/projects to interact with the Euclid layer, we will be providing a breakdown of the execute messages as well as the queries. For the rest of the contracts, no messages can be called directly on them so we are only interested in the available queries.

Common Types

A list of structs that are used in many of our contracts.

PairWithDenom

Specifies a token pair. The name and type for each token is specified.

pub struct PairWithDenom {
    pub token_1: TokenWithDenom,
    pub token_2: TokenWithDenom,
}
{
  "pair_with_denom": {
    "token_1": {
      "token": "token-1-id",
      "token_type": {
        "native": {
          "denom": "native-denom-1"
        }
      }
    },
    "token_2": {
      "token": "token-2-id",
      "token_type": {
        "native": {
          "denom": "native-denom-2"
        }
      }
    }
  }
}
FieldDescription
token_1Information about the first token.
token_2Information about the second token.

PairWithDenomAndAmount

Struct that specifies a token pair, their denoms, and an amount for each. Used when adding liquidity to a pool.

pub struct PairWithDenomAndAmount {
pub token_1: TokenWithDenomAndAmount,
pub token_2: TokenWithDenomAndAmount,
}

#[cw_serde]
pub struct TokenWithDenomAndAmount {
pub token: Token,
pub amount: Uint128,
pub token_type: TokenType,
}
NameTypeDescription
tokenTokenThe token Id for the token.
amountUint128The amount for the token.
token_typeTokenTypeThe type of token.

TokenWithDenom

Specifies information on one token. The name of the token and type is specified.

pub struct TokenWithDenom {
pub token: Token,
pub token_type: TokenType,
}

FieldDescription
tokenThe name of the token.
token_typeType of the token (native or smart).

Token

pub struct Token(String);

TokenType

The type of token. Can be either:

  • Native: Specify the denomination of the token.
  • Smart: CW20 token. Specify the contract address for the token.
  • Voucher: Euclid voucher tokens.
pub enum TokenType {
Native { denom: String },
Smart { contract_address: String },
Voucher {},
}

Pair

The token Id for each token in a token pair.

pub struct Pair {
pub token_1: Token,
pub token_2: Token,
}
NameTypeDescription
token_1TokenId of the first token in the pair.
token_2TokenId of the second token in the pair.

CrossChainUserWithLimit

Struct that defines a user address and limit on a specified chain. Used to define the amount of funds an address on a specific chain should receive.

pub struct CrossChainUserWithLimit {
    pub user: CrossChainUser,
    pub limit: Option<Uint128>,
}
"cross_chain_addresses":{
        "user": {
              "chain_uid": "chainA",
              "address": "comso1..."
                },
        "limit": "500"
    }
FieldTypeDescription
userCrossChainUserInformation on the cross chain user including the address and chain UID.
limitOption<Uint128>An optional limit to the amount of asset to be received by the user address. Will take the maximum amount if not specified.

CrossChainUser

The chain UID and address of the user.

pub struct CrossChainUser {
pub chain_uid: ChainUid,
pub address: String,
}


pub struct ChainUid(String);
FieldTypeDescription
chain_uidChainUidThe unique identifier of the chain.
addressStringThe address of the user on the chain.

Pagination

Struct used to define pagination parameters.

pub struct Pagination<T> {
    pub min: Option<T>,
    pub max: Option<T>,
    pub skip: Option<u64>,
    pub limit: Option<u64>,
}
"pagination": {
  "min": "3",       
  "max": "15",      
  "skip": 2,       
  "limit": 10       
    }
FieldTypeDescription
minTThe lower limit value, used to filter results. Type depends on the type of Id used.
maxTThe upper limit value, used to filter results. Type depends on the type of Id used.
skipu64Number of results to skip from the result set. Defaults to 0 if not specified.
limitu64Maximum number of results to return. Defaults to 10 if not specified.